<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel common\models\searches\OrderLogSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

/*$this->title = '订单日志';
$this->params['breadcrumbs'][] = $this->title;*/
?>
<div class="order-log-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('创建订单日志', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'order_id',
            'status',
            [
                'attribute'=>'status',
                'value'=>function($model){
                    return \common\models\Order::getStatusLabels($model->status);
                },
                'filter'=>Html::activeDropDownList(
                    $searchModel,
                    'status',
                    \common\models\Order::getStatusLabels(),
                    ['class'=>'form-control', 'prompt'=>'请选择']
                ),
            ],
            'remark',
            'created_at:datetime',
            // 'updated_at',
             [
                 'attribute'=>'created_by',
                 'value'=>function($model){
                 return $model->createdBy->username;
                 }
             ],
            // 'updated_by',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
</div>
